import React from 'react';

interface PaginationProps {
  pageIndex: number;
  total: number;
  pageSize: number;
  handlePreviousPage: () => void;
  handleNextPage: () => void;
}

const Pagination: React.FC<PaginationProps> = ({
  pageIndex,
  total,
  pageSize,
  handlePreviousPage,
  handleNextPage,
}) => {
  return (
    <div className="mt-4 flex items-center justify-center bg-gray-200 p-2">
      <button
        disabled={pageIndex <= 1}
        onClick={handlePreviousPage}
        className="mr-2 rounded bg-blue-500 px-3 py-1 text-white"
      >
        上一页
      </button>
      <span className="mx-2">当前页: {pageIndex}</span>
      <button
        disabled={pageIndex * pageSize >= total}
        onClick={handleNextPage}
        className="ml-2 rounded bg-blue-500 px-3 py-1 text-white"
      >
        下一页
      </button>
    </div>
  );
};

export default Pagination;